///
/// ArmyBodger 3
/// (c)2010 richyp
///
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ArmyBodger.Core {
    /// <summary>
    /// Collection of BaseUnit objects
    /// </summary>
    public class BaseUnitCollection : List<BaseUnit> {
        /// <summary>
        /// Indexer to get the BaseUnit by name
        /// </summary>
        /// <param name="name">The name of the BaseUnit to get</param>
        /// <returns>The BaseUnit object referenced by "name"</returns>
        public BaseUnit this[string name] {
            get {
                foreach (BaseUnit unit in this) {
                    if (unit.Name == name) {
                        return unit;
                    }
                }
                return null;
            }
        }
    }
}
